
package com.ydd.userserver.controller;


import com.ydd.common.dto.user.UserDto;
import com.ydd.common.result.ResponseResult;
import com.ydd.common.utils.LoginUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@RestController
@RequestMapping("/user")
@Api(tags = "userController")
public class UserController {
    @Autowired
    private LoginUtil loginUtil;

    @RequestMapping(value = "/openApi/getToken", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "创建token")
    public ResponseResult<String> getToken(@RequestBody UserDto userDto) {
        String token = loginUtil.createToken(userDto.getUserName(), userDto.getUserId(), userDto.getPlatform(), 15);
        return ResponseResult.success(token);
    }


}
